<template>
    <div>
        <van-nav-bar title="我的优惠券" left-text="返回" left-arrow @click-left="onClickLeft" />
        <van-card v-for="item in coupon" :desc="item.time" :title="item.name" :thumb="item.img" centered>
            <template #footer>
                <van-button size="mini" class="btn1">立即使用</van-button>
            </template>
        </van-card>
    </div>
</template>

<script setup lang="ts">
import { couponGet } from '../../api/home';
import { ref } from 'vue'
import router from '../../router';

interface coupon {
    name: string,
    component: string,
    edu: number,
    img: string,
    time: string,
    objectID: string,
}


let coupon = ref<Array<coupon>>([])
let res = await couponGet();
coupon.value = res.data.results


console.log(coupon.value);


//回退按钮！有bug只能回退一层，想办法解决
const onClickLeft = () => history.back();

</script>



<style lang="scss" scoped>
.btn1 {
    background-color: red;
    border-radius: 1.5rem;
    color: #ffffff;
}
</style>